java indexof array

108

java indexof array -

java.util.Arrays.asList(theArray).indexOf(o)

java array get index -

 public int getArrayIndex(int[] arr,int value) {

        int k=0;
        for(int i=0;i<arr.length;i++){

            if(arr[i]==value){
                k=i;
                break;
            }
        }
    return k;
}

Comments

Submit
0 Comments